package com.dman.multi.proxy;

import java.io.UnsupportedEncodingException;
import java.net.Proxy;

import org.apache.pivot.util.Base64;

public class ProxyAdaptor {
	public static final String DEFAULT_CHARSET = "US-ASCII";
	public static final ProxyAdaptor NO_PROXYAUTH = new ProxyAdaptor(Proxy.NO_PROXY, null);
	private String auth;
	private Proxy proxy;
	
	public ProxyAdaptor(Proxy proxy, String auth) {
		this.proxy = proxy;
		try {
			this.auth = null;
			if(auth != null)
				this.auth = Base64.encode(auth.getBytes(DEFAULT_CHARSET));
		} catch (UnsupportedEncodingException e) {}
	}

	public String getAuth() {
		return auth;
	}
	
	public Proxy getProxy() {
		return proxy;
	}
}
